﻿USE [%DATABASENAME%];

SET ANSI_NULLS ON;

SET QUOTED_IDENTIFIER ON;

CREATE TABLE [dbo].[KEYS](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[UPN] [varchar](50) NOT NULL,
	[SECRETKEY] [varchar](8000) NULL,
	[CERTIFICATE] [varchar](8000) NULL,
 CONSTRAINT [PK_REGISTRATIONS] PRIMARY KEY CLUSTERED ([ID] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [IX_KEYS_UPN] UNIQUE NONCLUSTERED ([UPN] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY];

USE [master];

ALTER DATABASE [%DATABASENAME%] SET READ_WRITE;

